//#include "StdAfx.h"
#include "DrawMarginal.h"


DrawMarginal::DrawMarginal()
{
}
/*   Draw Marginal
 rawImg: source image,witch is the input image to be deal with. 
 marImg: dst image,witch is the result image
 thresh: the thresh of cvcanny
*/
bool DrawMarginal::Drawing(IplImage* rawImg=0,IplImage* marImg=0,int thresh=50){
	if(!rawImg) { std::cout<<"DrawMarginal: raw image is NULL!"<<std::endl;  return false;}
	if(!marImg) { std::cout<<"DrawMarginal: marginal image is NULL"<<std::endl; return false;}
	Mat res = RollingGuidanceFilter::filter(rawImg,3,25.5,4);
	IplImage* rltImg = cvCreateImage(cvGetSize(rawImg),IPL_DEPTH_8U,1);
	rltImg =&IplImage(res);
	cvCanny(rltImg,marImg,thresh,thresh*3,3);
	cvReleaseImage(&rltImg);
}

/*
	Drawing marginal with internal elements    
*/                                                              
void DrawMarginal::DrawingWithInternal(IplImage* rawImg,IplImage* marImg,int thresh){
	cvCanny(rawImg,marImg,thresh,thresh*3,3);
}

DrawMarginal::~DrawMarginal(void)
{
}
